package com.tac.controller;

import com.tac.common.R;
import com.tac.pojo.Course;
import com.tac.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/course")
public class CourseCotroller {
    @Autowired
    private CourseService courseService;

    @GetMapping("/selectAll")
    public R selectAll(){
        List<Course> courses = courseService.selectAll();
        return R.success(courses,"查询成功");
    }
    /**
     * 删除课表
     * @param cid
     * @return
     */
    @DeleteMapping("/delete")
    public R delete(Integer cid){
        R r = courseService.delete(cid);
        return r;
    }
}
